//
//  FSHomeUpDoingController.m
//  WZSOA
//
//  Created by 刘沿 on 16/6/3.
//  Copyright © 2016年 刘沿. All rights reserved.
//

#import "FSHomeUpDoingController.h"

@interface FSHomeUpDoingController ()

@property (weak, nonatomic) IBOutlet UIView *View1;

@property (weak, nonatomic) IBOutlet UIView *View2;


@property (weak, nonatomic) IBOutlet UILabel *label1;


@property (weak, nonatomic) IBOutlet UILabel *label2;

@end

@implementation FSHomeUpDoingController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"待办工作";
    
    [self setUP];
    
}

- (void)setUP{
    
//标题栏
    UIView *view1 = [[UIView alloc] init];

    view1.backgroundColor = [UIColor whiteColor];
    
    [self.View1 addSubview:view1];
    
    [view1 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        //        make.top.equalTo(self.view.mas_top).with.offset(@44);
        
        make.top.equalTo(self.View1.mas_top).mas_offset(5);
        
        make.left.equalTo(self.View1.mas_left).mas_offset(10);
        
        make.right.equalTo(self.View1.mas_right).mas_offset(-10);
        
        make.height.equalTo(@40);
        
    }];
//待办收文图片
    UIImageView *iamgeV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"待办收文"]];
    [view1 addSubview:iamgeV];
    
    [iamgeV mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(view1.mas_top).mas_offset(5);
        
        make.left.equalTo(view1.mas_left).mas_offset(5);
        
        make.width.equalTo(@30);
        
        make.bottom.equalTo(view1.mas_bottom).mas_offset(-5);
    }];
//待办收文文字
    UILabel *lbl = [[UILabel alloc] init];
    
    lbl.text = @"待办收文";
    
    [view1 addSubview:lbl];
    
    [lbl mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(view1.mas_top).mas_offset(5);
        
        make.left.equalTo(iamgeV.mas_right).mas_offset(5);
        
        make.bottom.equalTo(view1.mas_bottom).mas_offset(-5);
        
        make.width.equalTo(@200);
    }];
    
    
    UIView *view2 = [[UIView alloc] init];
    [self.View1 addSubview:view2];
    
    [view2 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(view1.mas_bottom).mas_offset(5);
        
        make.left.equalTo(self.View1.mas_left).mas_offset(10);
        
        make.right.equalTo(self.View1.mas_right).mas_offset(-10);
        
//        make.height.equalTo(@(H));
        
        make.bottom.equalTo(self.View1.mas_bottom).mas_offset(-10);
        
        
    }];
    
//标题栏
    UIView *view3 = [[UIView alloc] init];
    view3.backgroundColor = [UIColor whiteColor];
    [self.View2  addSubview:view3];
    
    [view3 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.View2.mas_top).mas_offset(10);
        
        make.left.equalTo(self.view.mas_left).mas_offset(10);
        
        make.right.equalTo(self.view.mas_right).mas_offset(-10);
        
        make.height.equalTo(@40);
        
    }];
    
//待办发文
    UIImageView *imagView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"待办发文"]];
    
    [view3 addSubview:imagView];
    
    [imagView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(view3.mas_top).mas_offset(5);
        
        make.left.equalTo(view3.mas_left).mas_offset(5);
        
        make.bottom.equalTo(view3.mas_bottom).mas_offset(-5);
        
        make.width.equalTo(@30);
    }];
    
//待办文字
    UILabel *label = [[UILabel alloc] init];
    
    label.text = @"待办发文";
    
    [view3 addSubview:label];
    
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(view3.mas_top).mas_offset(5);
        
        make.left.equalTo(imagView.mas_right).mas_offset(5);
        
        make.bottom.equalTo(view3.mas_bottom).mas_offset(-5);
        
        make.width.equalTo(@200);
        
    }];
    
    
    UIView *view4 = [[UIView alloc] init];
    [self.View2 addSubview:view4];
    
    [view4 mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(view3.mas_bottom).mas_offset(5);
        
        make.left.equalTo(self.view.mas_left).mas_offset(10);
        
        make.right.equalTo(self.view.mas_right).mas_offset(-10);
        
        //        make.bottom.equalTo(self.view.mas_bottom);
        
//        make.height.equalTo(@(H));
        
        make.bottom.equalTo(self.View2.mas_bottom).mas_offset(-10);
    }];
    
// 待办收文
    FSUpDoingReceiveController *rec = [[FSUpDoingReceiveController alloc] init];
    
    rec.type = UpToReceive;
    
    rec.view.frame = view2.bounds;
    
    [view2 addSubview:rec.view];
    
//待办发文
    FSUpDoingReceiveController *rec2 = [[FSUpDoingReceiveController alloc] init];
    
    rec2.type = UpToSend;
    
    rec2.view.frame = view4.bounds;
    
    [view4 addSubview:rec2.view];
    
    
    UIStoryboard *story = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    [rec setDetailBlock:^(NSInteger index, NSString *field,NSString *iseditor,NSString *form) {
        
        FSUpDoingDetailController *upDetail = [story instantiateViewControllerWithIdentifier:@"UpDoingDetailVC"];
        
        upDetail.fileId = field;
        upDetail.form = form;
        if ([iseditor isEqualToString:@"1"]) {
            upDetail.isUnDoWork = NO;
        }else{
            upDetail.isUnDoWork = YES;
        }
        [self.navigationController pushViewController:upDetail animated:YES];
        
        
    }];
    
    [rec2 setDetailBlock:^(NSInteger index, NSString *field,NSString *is,NSString *form) {
        
        FSUpDoingDetailController *upDetail = [story instantiateViewControllerWithIdentifier:@"UpDoingDetailVC"];
        upDetail.form = form;
        
        if ([is isEqualToString:@"1"]) {
            upDetail.isUnDoWork = NO;
            
        }else{
            upDetail.isUnDoWork = YES;
        }
        upDetail.fileId = field;
        
        [self.navigationController pushViewController:upDetail animated:YES];
        
        
    }];

}


@end











